set more off
set maxvar 20000

*Define directory with input data
cd "Q:"

*Create CPI-W extract
import excel cpi_w.xlsx, firstrow
drop cpi_w
save cpi_w, replace

*Create 2020 Tracker file extract
use "trk2020tr_r.dta", clear
rename *, lower
gen hhidpn = hhid+pn
keep hhidpn hhid pn secu stratum yrenter ?iwyear ?iwmonth ?wgtr ?wgtrnh 

reshape long @iwyear @iwmonth @wgtr @wgtrnh, i(hhidpn) j(wave) string

gen waveyr=1992 if wave=="a"
replace  waveyr=1993 if wave=="b"
replace  waveyr=1994 if wave=="c"
replace  waveyr=1995 if wave=="d"
replace  waveyr=1996 if wave=="e"
replace  waveyr=1998 if wave=="f"
replace  waveyr=2000 if wave=="g"
replace  waveyr=2002 if wave=="h"
replace  waveyr=2004 if wave=="j"
replace  waveyr=2006 if wave=="k"
replace  waveyr=2008 if wave=="l"
replace  waveyr=2010 if wave=="m"
replace  waveyr=2012 if wave=="n"
replace  waveyr=2014 if wave=="o"
replace  waveyr=2016 if wave=="p"
replace  waveyr=2018 if wave=="q"
keep if waveyr!=.
sort hhidpn waveyr
drop wave

destring hhidpn, replace

save tracker_2020_early, replace
